{% extends 'template.html' %}

{% block username %}
    {{ head.username }}
{% endblock %}

{% block content %}
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">{{ head.value }}</h1>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <div class="btn-group">
                            <a>
                                <button id='bt-search' type="button" class="btn btn-success">高级搜索</button>
                            </a>
                            <a>
                                <button id='bt-reset' type="button" class="btn btn-danger">重置高级搜索</button>
                            </a>
                            <div id="test" data-my-object="{{ workflow_id_model_dict }}"></div>
                        </div>
                        <div class="pull-right">
                            <div class="btn-group">
                            </div>
                        </div>
                    </div>
                    <div class="panel-body">
                        <div id="div-search" class="hide">
                            <table id="high-search" style="width: 50%; margin: 0 auto 2em auto;" border="0"
                                   cellpadding="3" cellspacing="0">
                                <thead>
                                <tr>
                                    <th>目标</th>
                                    <th>内容</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr id="_filter_workflow" data-column="2">
                                    <td>流程名称(可多选)</td>
                                    <td align="center">
                                        <select id="filter_workflow" style="width: 100%" multiple>
                                            {#                                            <option value="0" selected="selected">全部</option>#}
                                            {% for w in all_workflow %}
                                                <option value={{ w.id }}>{{ w.name }}</option>
                                            {% endfor %}
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_state_value" data-column="2">
                                    <td>审批状态(可多选)</td>
                                    <td align="center">
                                        <select id="filter_state_value" style="width: 100%" multiple>
                                            <option value="完成">完成</option>
                                            <option value="审核中">审核中</option>
                                            <option value="拒绝">拒绝</option>
                                            <option value="取消">取消</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_status" data-column="2">
                                    <td>处理状态</td>
                                    <td align="center">
                                        <select id="filter_status" style="width: 100%">
                                            <option value="100">全部</option>
                                            <option value="0">已处理</option>
                                            <option value="99">未处理或故障中</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_time" data-column="4">
                                    <td>申请时间</td>
                                    <td align="center">
                                        <input style="width:100%" class="column_filter flatpickr flatpickr-input form-control" id="filter_time" type="text">
                                    </td>
                                </tr>
                                <tr id="_filter_creator" data-column="5">
                                    <td>工单发起人</td>
                                    <td align="center"><input style="width:100%" class="column_filter"
                                                              id="filter_creator" type="text"></td>
                                </tr>
                                <tr id="_filter_applicant" data-column="5">
                                    <td>申请人</td>
                                    <td align="center"><input style="width:100%" class="column_filter"
                                                              id="filter_applicant" type="text"></td>
                                </tr>
                                <tr id="_filter_title" data-column="6">
                                    <td>标题</td>
                                    <td align="center"><input style="width:100%" class="column_filter" id="filter_title"
                                                              type="text"></td>
                                </tr>
                                <tr id="_filter_state" data-column="6">
                                    <td>当前节点</td>
                                    <td align="center"><input style="width:100%" class="column_filter" id="filter_state"
                                                              type="text"></td>
                                </tr>
                                <!--<tr id="_filter_svn_state" data-column="6">
                                    <td>svn未处理工单</td>
                                    <td align="center"><input type="checkbox" id='svn_processed'></td>
                                </tr>
                                <tr id="_filter_ser_per_state" data-column="6">
                                    <td>服务器权限未处理工单</td>
                                    <td align="center"><input type="checkbox" id='serper_processed'></td>
                                </tr>-->
                                <tr id="_filter_admin" data-column="2">
                                    <td>网络管理员处理人</td>
                                    <td align="center">
                                        <select id="filter_admin" style="width: 100%">
                                            <option value="0" selected="selected">全部</option>
                                            {% for id, username in admin_list_dict.items %}
                                                <option value={{ id }}>{{ username }}</option>
                                            {% endfor %}
                                        </select>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <table id="mytable" class="display" width="100%" cellspacing="0">
                            <thead>
                            <tr>
                                <th>id</th>
                                <th>流程名称</th>
                                <th>申请时间</th>
                                <th>工单发起人</th>
                                <th>申请人</th>
                                <th>标题</th>
                                <th>审批节点</th>
                                <th>审批状态</th>
                                <th>处理状态</th>
                                <th>有效状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
            <!-- Modal -->
            <div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="myModalLabel"></h4>
                        </div>
                        <div class="modal-body">
                            <div class="alert alert-danger alert-dismissable" id='modal-notify'>
                                <button type="button" class="close" id="bt-modal-notify">&times;</button>
                                <label id='lb-msg'></label>
                            </div>
                            <form class="form-horizontal" role="form">
                                <div class="form-group" id='show_id'>
                                    <label class="col-sm-3 control-label">id</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control " placeholder="" id="id">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">游戏项目中文名</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="project_name">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">游戏项目英文名</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="project_name_en">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">状态</label>
                                    <div class="col-sm-8">
                                        <select class="form-control" id="status">
                                            <option value=0>停用</option>
                                            <option value=1 selected="selected">可用</option>
                                        </select>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button id='bt-save' type="button" class="btn btn-primary">保存</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->
            <div class="modal fade" id="Modal-file" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <form id="submit-file-form" enctype="multipart/form-data" action="/assets/upload_devices"
                              method="post">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;
                                </button>
                                <h4 class="modal-title" id="myModalLabel">导入/导出</h4>
                            </div>
                            <div class="modal-body">
                                <div class="alert alert-dismissable" id='upload-notify'>
                                    <button type="button" class="close" id="bt-upload-notify">&times;</button>
                                    <label id='lb-msg-upload'></label>
                                </div>

                                <!-- {% csrf_token %} -->
                                <div class="form-group">
                                    {{ form }}
                                    <p class="help-block">Example block-level help text here.</p>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                <button type="submit" class="btn btn-primary" name='action'>保存</button>
                            </div>
                        </form>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div>
        </div>
    </div>
    <input style="display: none;" value="{{ head.is_superuser }}" id="is_superuser">
{% endblock %}
{% block bodyjs %}
    <script src="/static/js/jquery.dataTables.js"></script>
    {{ django_context_varable }}
    {% verbatim %}
    <script id="tpl" type="text/x-handlebars-template">
        {{#each func}}
        <button type="button" class="btn btn-{{this.type}} btn-sm" onclick="{{this.fn}}">{{this.name}}</button>
        {{/each}}
    </script>
    {% endverbatim %}
    <script src="/static/js/handlebars-v3.0.1.js"></script>
    <script src="/static/js/workflow_histroy_all.js?v=20191210002"></script>
    <script src="/static/js/flatpickr.js"></script>
    <script src="/static/js/zh.js"></script>
{% endblock %}
{% block css %}
    <link href="/static/css/jquery.dataTables.css" rel="stylesheet" type="text/css">
    <link href="/static/css/mycss.css" rel="stylesheet" type="text/css">
    <link href="/static/css/flatpickr.css" rel="stylesheet" type="text/css">
    <link href="/static/css/flatpickr_material_green.css" rel="stylesheet" type="text/css">
{% endblock %}
